import type { StoreTypes } from '@/models/connect';
import type { Store, Dispatch } from '@/models/connect';

// 空间值
export const namespace = 'xBom';

interface BaseProps {
  history: History;
  location: Location;
  match: any;
  children: any;
  route: any;
  routes: any[];
  [key: string]: any;
}

interface DispatchToProps {
  query: (payload: any) => void;
  querySlectOrders: (payload: any) => void;
  save: (payload: any) => void;
  createXbom: (payload: any) => void;
  queryXbom: (payload: any) => void;
  receiveOrderEffect: (payload: any) => void;
}

// 接口枚举
export const XBomEffects = Object.freeze({
  query: `${namespace}/query`,
  querySlectOrders: `${namespace}/querySlectOrders`,
  save: `${namespace}/save`,
  createXbom: `${namespace}/createXbom`,
  queryXbom: `${namespace}/queryXbom`,
  receiveOrderEffect: `${namespace}/receiveOrderEffect`,
});

// 当前页面的dva数据
export type InitialState = {
  list: any[];
  searchParams: any;
  selectedRows: any[];
  xbomDetailVisible: boolean;
  xbomData: any;
  recipientListVisible: boolean;
  defaultPeopleSetListVisible: boolean;
  [key: string]: any;
};

// conect的第一个参数类型
export type DvaState = Store;

// conect的第二个参数类型
export type DispatchProps = Dispatch;

// 页面参数类型
export interface PageProps extends StoreTypes.userState, DispatchToProps, BaseProps {
  [namespace]: InitialState;
  gridLoading: boolean;
  createXbomLoading: boolean;
  reveiceOrderLoading: boolean;
  userId: string;
}
